Skip to content

Improve cached_classproperty type annotations#6341

Open
amogus07 wants to merge 1 commit intomasterfrom
cached-classproperty
Open

Improve cached_classproperty type annotations#6341
amogus07 wants to merge 1 commit intomasterfrom
cached-classproperty

Conversation

@amogus07
Copy link
Copy Markdown
Contributor

@amogus07 amogus07 commented Feb 2, 2026

Description

Basically a followup to #6110

To Do

  • Documentation
  • Changelog
  • Tests

@amogus07 amogus07 requested a review from a team as a code owner February 2, 2026 20:57
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.19%. Comparing base (7c50f94) to head (4b222ea).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6341      +/-   ##
==========================================
+ Coverage   72.15%   72.19%   +0.04%     
==========================================
  Files         159      159              
  Lines       20645    20675      +30     
  Branches     3269     3268       -1     
==========================================
+ Hits        14897    14927      +30     
  Misses       5041     5041              
  Partials      707      707              
Files with missing lines Coverage Δ
beets/autotag/distance.py 83.58% <100.00%> (+0.06%) ⬆️
beets/autotag/hooks.py 98.89% <100.00%> (+<0.01%) ⬆️
beets/dbcore/db.py 93.93% <100.00%> (+0.07%) ⬆️
beets/importer/tasks.py 91.17% <100.00%> (+0.01%) ⬆️
beets/library/models.py 87.23% <100.00%> (+0.21%) ⬆️
beets/metadata_plugins.py 84.84% <100.00%> (+0.09%) ⬆️
beets/util/__init__.py 79.52% <100.00%> (+0.28%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@snejus
Copy link
Copy Markdown
Member

snejus commented Mar 2, 2026

What does addition of T2 solve/improve here? I'm fine with the new cache_clear method.

@amogus07
Copy link
Copy Markdown
Contributor Author

amogus07 commented Mar 2, 2026

T is the class the decorated method belongs to, T2 is it's return type

@snejus
Copy link
Copy Markdown
Member

snejus commented Mar 3, 2026

Do you know if it's possible to somehow force mypy to think that cached_classproperty accepts a cls (type of the class) instead of self?

@JOJ0 JOJ0 added the core Pull requests that modify the beets core `beets` label Apr 6, 2026
@amogus07 amogus07 force-pushed the cached-classproperty branch from ed0f50d to 4b222ea Compare May 10, 2026 15:21
@amogus07 amogus07 requested a review from semohr as a code owner May 10, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Pull requests that modify the beets core `beets`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants